<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f" %>
<%@taglib prefix="joda" uri="http://www.joda.org/joda/time/tags" %>

<form method="post" action="/Orcamento/exchange/save">
	<fieldset>
		<legend>Transferencia</legend>
		<label>
			Fundo Origem
			<select name="exchange.origin.id" required>
				<option value="">Selecione um Fundo</option>
				<c:forEach items="${funds}" var="fund">
					<c:choose>
						<c:when test="${exchange.origin.id != fund.id}">
							<option value="${fund.id}">${fund.event.name}</option>
						</c:when>
						<c:otherwise>
							<option value="${fund.id}" selected>${fund.event.name}</option>
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</select>
		</label>
		<label>
			Fundo de Destino
			<select name="exchange.destiny.id" required>
				<option value="">Selecione um evento</option>
				<c:forEach items="${funds}" var="fund">
					<c:choose>
						<c:when test="${exchange.destiny.id != fund.id}">
							<option value="${fund.id}">${fund.event.name}</option>
						</c:when>
						<c:otherwise>
							<option value="${fund.id}" selected>${fund.event.name}</option>
						</c:otherwise>
					</c:choose>
				</c:forEach>
			</select>
		</label>
		<label>
			Valor
			<input type="text" value="${exchange.value}" name="exchange.value" required placeholder="Expectativa de Ganho" class="money" />
		</label>
		<label>
			Dia
			<input type="date" value="<joda:format value="${exchange.date}" pattern="YYYY-MM-dd" />" name="exchange.date" required class="input-medium" />
		</label>
		<input type="hidden" name="exchange.id" value="${exchange.id}">
		<button type="submit" class="btn" id="submit">Cadastrar</button>
	</fieldset>
</form>